home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 20 Feb 2002
- //
- // Description:
- // This is a helper script to set fluid gradient types
- // using the corresponding option box values.
- //
- global proc doFluidGradients( int $version, string $args[] )
- {
- if(( $version < 1 ) || ( size( $args ) < 8 )) {
- error( "Incorrect version/argument list" );
- return;
- }
-
- if( !`exists getActiveFluidShapes` ) {
- source getFluidShape.mel;
- }
- string $fluids[] = getActiveFluidShapes();
- if( size( $fluids ) == 0 ) {
- error( "No fluid selected" );
- return;
- }
-
- int $doDensity = $args[0];
- int $densityType = $args[1];
-
- int $doVelocity = $args[2];
- int $velocityType = $args[3];
-
- int $doTemperature = $args[4];
- int $temperatureType = $args[5];
-
- int $doFuel = $args[6];
- int $fuelType = $args[7];
-
- if( !( $doFuel || $doTemperature || $doVelocity || $doDensity ) ) {
- error( "Must choose at least one fluid property on which to apply a gradient" );
- return;
- }
-
- string $densityValues, $densityEnables;
- string $velocityValues, $velocityEnables;
- string $temperatureValues, $temperatureEnables;
- string $fuelValues, $fuelEnables;
-
- // Have enough values for the setAttr cmd to work on
- // all active fluids.
- //
- for( $f in $fluids ) {
- // "3" is the setAttr value for gradient.
- //
- $densityEnables += "3 ";
- $velocityEnables += "3 ";
- $temperatureEnables += "3 ";
- $fuelEnables += "3 ";
-
- // Have to add three since the option box values
- // are 1-based and the first gradient method ATTR
- // value is 4...
- //
- $densityValues += ($densityType + 3) + " ";
- $velocityValues += ($velocityType + 3) + " ";
- $temperatureValues += ($temperatureType + 3) + " ";
- $fuelValues += ($fuelType + 3) + " ";
- }
-
- if( $doDensity ) {
- evalEcho( "setAttr \".densityMethod\" " + $densityEnables );
- evalEcho( "setAttr \".densityGradient\" " + $densityValues );
- }
- if( $doVelocity ) {
- evalEcho( "setAttr \".velocityMethod\" " + $velocityEnables );
- evalEcho( "setAttr \".velocityGradient\" " + $velocityValues );
- }
- if( $doTemperature ) {
- evalEcho( "setAttr \".temperatureMethod\" " + $temperatureEnables );
- evalEcho( "setAttr \".temperatureGradient\" " + $temperatureValues );
- }
- if( $doFuel ) {
- evalEcho( "setAttr \".fuelMethod\" " + $fuelEnables );
- evalEcho( "setAttr \".fuelGradient\" " + $fuelValues );
- }
- }
-